require("./webapp/server");
const { app, BrowserWindow } = require('electron');
let win
function createWindow() {
    win = new BrowserWindow({
        width:1000,
        height:800,
        // fullscreen: true,//全屏显示
        // kiosk: true,  //服务亭模式
        resizable: false,//不可更改窗口尺寸
        // frame: false,  //是否显示窗口边缘框架
        // closable: false,//是否显示关闭
        maximizable: false,//禁止最大化
        show: false //为了让初始化窗口显示无闪烁，先关闭显示，等待加载完成后再显示。
    });
    win.once('ready-to-show', () => {
        win.show()
    })
    win.loadURL("http://127.0.0.1:8484");
    // Open the DevTools.
    // win.webContents.openDevTools()
    // Emitted when the window is closed.
    win.on('closed', () => {
        // Dereference the window object, usually you would store windows
        // in an array if your app supports multi windows, this is the time
        // when you should delete the corresponding element.
        win = null
    })
}
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', createWindow)
// Quit when all windows are closed.
app.on('window-all-closed', () => {
    // On macOS it is common for applications and their menu bar
    // to stay active until the user quits explicitly with Cmd + Q
    if (process.platform !== 'darwin') {
        app.quit()
    }
})
app.on('activate', () => {
    // On macOS it's common to re-create a window in the app when the
    // dock icon is clicked and there are no other windows open.
    if (win === null) {
        createWindow()
    }
})